package com.jiyinit.web.core.video.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.jiyinit.core.framework.base.paging.PagingResult;
import com.jiyinit.web.core.video.dao.TabCoreIconMainDao;
import com.jiyinit.web.core.video.dto.IconMainRequest;
import com.jiyinit.web.core.video.entity.TabCoreIconMainEntity;

@Service("core.iconMainServiceImpl")
public class IconMainServiceImpl {
	
	@Resource(name = "core.tabCoreIconMainDao")
	private TabCoreIconMainDao tabCoreIconMainDao;
	
	
	/**
     * 多条件分页查询
     * @param request
     * @return
     */
	public PagingResult<TabCoreIconMainEntity> findForPage(IconMainRequest request){
        return tabCoreIconMainDao.findForPage(request);
    }
	
	/**
	 * id查询
     * @param id
     * @return
     */
	public TabCoreIconMainEntity findOne(Integer id){
		return tabCoreIconMainDao.findOne(id);
	}
	
	/**
	 * 添加
     * @param entity
     * @return
     */
	public int add(TabCoreIconMainEntity entity){
		return tabCoreIconMainDao.add(entity);
	}
	
	/**
	 * 修改
     * @param entity
     * @return
     */
	public int update(TabCoreIconMainEntity entity){
		return tabCoreIconMainDao.update(entity);
	}
	
	/**
	 * 删除
     * @param id
     * @return
     */
	public int delete(Integer id){
		return tabCoreIconMainDao.delete(id);
	}


	public List<TabCoreIconMainEntity> findNoInIds(String[] notInIds){
		StringBuffer sbf = new StringBuffer();
		for (int i = 0; i < notInIds.length; i++) {
			if(i==0){
				sbf.append(notInIds[i]);
			}else{
				sbf.append("," + notInIds[i]);
			}
		}
		return tabCoreIconMainDao.findNoInIds(sbf.toString());
	}

	public List<TabCoreIconMainEntity> findInIds(String[] ids){
		StringBuffer sbf = new StringBuffer();
		for (int i = 0; i < ids.length; i++) {
			if(i==0){
				sbf.append(ids[i]);
			}else{
				sbf.append("," + ids[i]);
			}
		}
		return tabCoreIconMainDao.findInIds(sbf.toString());
	}
	
}
